/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function getInventory(warehouseNum)
{
    //$("#inventory_" + warehouseNum).html("<img src='ajax-loader.gif'/>");

    $.ajax({
        type: "GET",
        url: "http://localhost:8080/AdminWHandMan/adminServlet?reqtype=1&warehouse=" + warehouseNum
    }).done(function(msg){
        $("#inventory_" + warehouseNum).html(msg);

        dis = $("#warehouse_" + warehouseNum).css("display");

        if( dis == "none" )
        {
            $("#warehouse_" + warehouseNum).slideToggle();
        }
    });

}


function getOrders(manuNum)
{
    $.ajax({
        type: "GET",
        url: "http://localhost:8080/AdminWHandMan/adminServlet?reqtype=2&manufacturer=" + manuNum
    }).done(function(msg){
        $("#orders_" + manuNum).html(msg);

        dis = $("#manufacturer_" + manuNum).css("display");

        if( dis == "none" )
        {
            $("#manufacturer_" + manuNum).slideToggle();
        }
    });
}

var invPos = 0;
function toggleInv()
{
    if( invPos == 0 )
    {
        $("#arrow1").attr("src","arrow.png");
        $('#inventories').slideDown();
        invPos = 1;
    }
    else if( invPos == 1 )
    {
        $("#arrow1").attr("src","arrow2.png");
        $('#inventories').slideUp();
        invPos = 0;
    }
}

var ordersPos = 0;
function toggleOrders()
{
    if( ordersPos == 0 )
    {
        $("#arrow2").attr("src","arrow.png");
        $('#orders').slideDown();
        ordersPos = 1;
    }
    else if( ordersPos == 1 )
    {
        $("#arrow2").attr("src","arrow2.png");
        $('#orders').slideUp();
        ordersPos = 0;
    }
}

